import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'


//懒加载
const About =() => import('../views/About')

//引入链表组件
const List =() => import('../views/List/List')
const LinkedList=()=>('../components/List/LinkedList')
const Stack=()=>('../components/List/Stack')
const Queue=()=>('../components/List/Queue')
const DoublyLinkedList=()=>('../components/List/DoublyLinkedList')
const Deque=()=>('../components/List/Deque')

//引入排序组件
const Sort =() => import('../views/Sort/Sort.vue')
const CompareSort=()=>import('../components/Sort/CompareSort.vue')
const RadixSort=()=>import('../components/Sort/RadixSort.vue')
const HeapSort=()=>import('../components/Sort/HeapSort.vue')




//引入树组件
const Tree =() => import('../views/Tree/Tree.vue')
const BstTree=()=>import('../components/Tree/BstTre.vue')
const HeapTree=()=>import('../components/Tree/HeapTree.vue')
const HuffmanTree=()=>import('../components/Tree/HuffmanTree.vue')
const AvlTree=()=>import('../components/Tree/AvlTree.vue')
const ChangeToBST=()=>import('../components/Tree/ChangeToBST.vue')
const ThreadedBST=()=>import('../components/Tree/ThreadedBST.vue')

//引入图组件
const Graph =() => import('../views/Graph/Graph.vue')

//引入字符串组件
const String =() => import('../views/String/String.vue')

Vue.use(VueRouter)

const routes = [
  {
    path:'',
    redirect:'/home'
  },
  //主页
  {
    path: '/home',
    name: 'Home',
    component: Home,   
  },
  //关于
  {
    path: '/about',
    name: 'About',
    //懒加载
    component: About
  },
  //排序
  {
    path:'/sort',
    name:'Sort',
    component:Sort,
    children:[
      //比较排序
      {      
        path:'/compareSort',
        component:CompareSort
      },
      //基数排序
      {
        
        path:'/radixSort',
        component:RadixSort
      },
      //堆排序
      {
        
        path:'/heapSort',
        component:HeapSort
      }
    ]
  },
  //链表
  {
    path:'/list',
    name:'List',
    component:List,
    children:[
      //链表
      {
        path:'/linkedList',
        component:LinkedList
      },
      //栈
      {
        path:'/stack',
        component:Stack
      },
      //队列
      {
        path:'/queue',
        component:Queue
      },
      //双向链表
      {
        path:'/doublyLinkedList',
        component:DoublyLinkedList
      },
      //双端队列
      {
        path:'/deque',
        component:Deque
      }
    ]
  },
  //树
  {
    path:'/tree',
    name:'Tree',
    component:Tree,
    children:[
      //二叉树
      {
        path:'/bstTree',
        component:BstTree
      },
      //堆树
      {
        path:'/heapTree',
        component:HeapTree
      },
      //霍夫曼树
      {
        path:'/huffmanTree',
        component:HuffmanTree
      },
      //平衡树
      {
        path:'/avlTree',
        component:AvlTree
      },
      //转为二叉树
      {
        path:'/changeToBST',
        component:ChangeToBST
      },
      //线索二叉树
      {
        path:'/threadedBST',
        component:ThreadedBST
      }
    ]
  },
  //图
  {
    path:'/graph',
    name:'Graph',
    component:Graph
  },
  //字符串
  {
    path:'string',
    name:'String',
    component:String
  }
]

const router = new VueRouter({
  routes
})

export default router
